const path = require("path");
module.exports = {
    publicPath: './',
    lintOnSave: false,
    outputDir: 'dist',
	productionSourceMap: false,
    chainWebpack: config => {
		// 删除预加载
		config.plugins.delete('preload');
		config.plugins.delete('prefetch');
		// 压缩代码
		config.optimization.minimize(true);
		// 分割代码
		config.optimization.splitChunks({
			chunks: 'all'
		})
        config.resolve.alias
            .set("@", path.resolve("src"))
            .set("@assets", path.resolve("src/assets"))
            .set("@views", path.resolve("src/views"))
			.set("@request", path.resolve("src/request"))
            .set("@components", path.resolve("src/components"))
            .set("@utils", path.resolve("src/assets/utils"));
    },
	css: {
	    loaderOptions: {
	      sass: {
	        prependData: `
	          @import "@assets/css/_variable.scss";
	        `
	      }
	    }
	  },
    devServer: {
        // host: '',//target host
        port: 8675,
        proxy: {
            '/api': {
				// target:'http://mts2.jdcloud.com/',
                target: 'http://ticket2.jdcloud.com/',//代理地址，这里设置的地址会代替axios中设置的baseURL
                changeOrigin: true,// 如果接口跨域，需要进行这个参数配置
                //ws: true, // proxy websockets
                //pathRewrite方法重写url
                pathRewrite: {
                    '^/api': 'api'
                }
            }
        }
    },

}